import {timeago} from '../../util/util.js'
const app = getApp()
const db = wx.cloud.database()
Component({
  /**
   * 组件的属性列表
   */

  options: {
    styleIsolation: 'apply-shared'
  },
  properties: {
   userInfo: Object,
   content: Object,
   picture: Object, 
  },

  /**
   * 组件的初始数据
   */
  data: {
    time: ""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //跳转个人主页
    toperDetail(){
      wx.navigateTo({
        url: '/pages/personal-detail/personal-detail?myid=' + this.properties.userInfo._id,
      })
    },


    //删除动态
    delet(event){
      console.log(event)
      console.log(222)
      const id = 1
      wx.showModal({
        title: '提示',
        content: '是否删除该动态',
        success: (res)=> {
          if (res.confirm) {
            this.triggerEvent('delet')
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
    },  
  },

  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached(options){
      const time = timeago(this.properties.content.time)
      console.log(time)
      this.setData({
        time
      })
     },
  },
})
